#
import argparse
from typing import Dict
from apps.fmcw.fmcw_app import FmcwApp
from apps.fmcw.mpe_cnn_app import MpeCnnApp
from apps.fmcw.mpe_cnn_app_v3 import MpeCnnAppV3



def t001(params:Dict = {}):
    y_fn = '/home/psdz/diskc/yantao/adev/iragent/work/datasets/mpe/y_00125.pt'
    arrs0 = y_fn.split('/')
    fn_stem = y_fn[-9:]
    folder = y_fn[:-10]
    y_p_fn = f'{folder}y_p{fn_stem}'
    y_rvt_fn = f'{folder}y_rvt{fn_stem}'
    print(f'y_p_fn: {y_p_fn}   ;')
    print(f'y_rvt_fn: {y_rvt_fn}   ;')

def main(params:Dict = {}) -> None:
    print(f'FMCW试验平台 v0.0.1')
    print(f'run_mode={params["run_mode"]}; ann_dtype={params["ann_dtype"]};')
    if params['run_mode'] == 1:
        print(f'case 1')
        params['mode'] = 2 # MPE CNN
        FmcwApp.startup(params=params)
    elif params['run_mode'] == 2:
        print(f'case 2')
        MpeCnnApp.startup(params=params)
    elif params['run_mode'] == 3:
        MpeCnnAppV3.startup(params=params)
    else:
        t001(params=params)


def parse_args() -> argparse.Namespace:
    parser = argparse.ArgumentParser()
    parser.add_argument(
        '--run_mode', action='store',
        type=int, default=1, dest='run_mode',
        help='run mode'
    )
    # 神经网络的数据类型：1-为实数；2-为复数；
    parser.add_argument(
        '--ann_dtype', action='store',
        type=int, default=1, dest='ann_dtype',
        help='ann dtype'
    )
    return parser.parse_args()

if '__main__' == __name__:
    args = parse_args()
    params = vars(args)
    main(params=params)